// 定义分类相关api接口函数
import request from "@/utils/request";

// 获取所以商品分类(顶级、二级、对应的商品推荐数据)
export const getAllCategory = () => {
  return request('/home/category/head', 'get')
}

/**
 * 获取顶级类目 - 子分类children
 * @param {String} id
 * @returns Promise
 */
export const getTopCategory = (id) => {
  return request('/category', 'get', { id })
}

// 获得二级类目下的筛选条件数据
export const getSubCategory = (id) => {
  return request('/category/sub/filter', 'get', { id })
}

/**
 * 获取二级分类下的商品数据(带筛选条件)
 * @param {Object} params
 * @returns Promise
 */
export const getSubCategoryGoods = (params) => {
  return request('/category/goods/temporary', 'post', params)
}
